//Timer
//Used mainly for the surreal time system
//Simply schedules a proc call in a certain amount of time
//To cancel the timer, delete it

Timer
	var/time as num
	New(_time as num, procname, procobj)
		time = _time
		if(!_time || !procname || !procobj) return 0
		spawn(1) Timer(procname, procobj)
	proc/Timer(procname, procobj)
		set background=1
		sleep(time)
		if(!procobj) return 0
		call(procobj,procname)()

	ArgTimer //Not used by anything yet. Here for completeness.
		New(_time as num, procname, procobj, procargs)
			time = _time
			if(!_time || !procname || !procobj) return 0
			spawn() Timer(procname, procobj, procargs)
		Timer(procname, procobj, procargs)
			set background=1
			sleep(time)
			if(!procobj) return 0
			CallProc(procname,procobj,procargs)